package edu.nwpu.zya.coreops.modules.monitor.controller;

import edu.nwpu.zya.coreops.common.utils.R;
import edu.nwpu.zya.coreops.modules.monitor.vo.RdsMonitorVo;
import edu.nwpu.zya.coreops.modules.monitor.service.RdsMonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("monitor/rdsMonitor")
public class RdsMonitorController {
    @Autowired
    private RdsMonitorService rdsMonitorService;

    @GetMapping("/series")
    public R series(@RequestParam("instanceId")String instanceId,@RequestParam("timePeriod")Integer timePeriod){
        List<RdsMonitorVo> series=rdsMonitorService.getSeriesByIdAndPeriod(instanceId,timePeriod);
        return R.ok().put("series",series);
    }
}
